﻿using Assets.Scripts.Interface;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JumpProp : AProp
{
    public MoveControl jump;//获取角色跳跃事件
    private float timer=0;//计时器
    [SerializeField, Tooltip("两次跳跃的时间间隔")]
    private float jumpTime = 0.5f;
    public override void Click()
    {
        if (jump != null)
        {
            if (timer>jumpTime)
            {
                jump.Jump();
                ReduceCount(1);
                timer = 0;
            }
        }
    }
    private void Update()
    {
        timer += Time.deltaTime;
    }


    public override void FixedAwake()
    {
      //  info = "磁暴飞行器。强大的推进力可以将小眭弹飞";
    }
    /// <summary>
    /// 被主角拾取的逻辑
    /// </summary>
    /// <param name="other"></param>
    protected override void OnTriggerEnter(Collider other)
    {
        base.OnTriggerEnter(other);
        jump = other.GetComponent<MoveControl>();
    }
}
